home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / PRG / nShell-Pro.sit / nShell-Pro / bin / .lt..rsrc / TEXT_16000_man general.txt < prev    next >
Text File  |  1994-11-27  |  993b  |  35 lines

  1.  
  2. NAME
  3.  
  4. Comparison Operators
  5.  
  6. SYNOPSIS
  7.  
  8. .op. value1 value2
  9.  
  10. DESCRIPTION
  11.  
  12. These operators are used to compare two parameters:
  13.  
  14.     .eq.    Equal
  15.     .ne.    Not Equal
  16.     .gt.    Greater Than
  17.     .lt.    Less Than
  18.     .ge.    Greater Than or Equal To
  19.     .le.    Less Than or Equal To
  20.  
  21. If both parameters are legal integers, an integer comparison is performed.  If one or both parameters are not integers, a string comparison is performed.
  22.  
  23. These comparison commands may be used to test the return value from a previous command.  It is important to note, however, that the comparison itself produces a return value and will overwrite "$?".  For this reason, the return code should be saved into a temporary variable before a series of comparisons are performed:
  24.  
  25.     command_x
  26.     set temp $?    # save the result
  27.     if .lt. $temp 0 then echo "A serious error has occurred." endif
  28.     if .eq. $temp 0 then echo "Everything is ok" endif
  29.     if .gt. $temp 0 then echo "command_x returned a value of" $temp endif
  30.  
  31. RETURN CODES
  32.  
  33. <0    Error
  34. 0    True
  35. 1    False